package com.lizx.eshop.service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 李振兴
 * @Description:
 * @Date: Create in 2019/1/31 1:27 PM
 */
@RestController
public class SayHelloService {

    @Value("${server.port}")
    private Integer port;

    @GetMapping("/say/hello")
    @HystrixCommand(fallbackMethod = "sayHelloFallback")
    public String sayHello(String name){
        return "hello "+name + " from "+ port;
    }

    public String sayHelloFallback(String name){
        return "error"+ name;
    }
}
